#pragma	once

#include <boost/atomic.hpp>

namespace	Z
{

//------------------------------------------------------------------------------------------------------------------------
class	SpinLock
{
public:
    SpinLock()	:	mLocked(false)	{
	}
    void	lock()	{
		while(mLocked.exchange(true, boost::memory_order_acquire) == true);
    }
    void	unlock()	{
		mLocked.store(false, boost::memory_order_release);
    }

private:
	boost::atomic<bool>	mLocked;
};

}